package com.rainxing.cockpit.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: ybzhu
 * @Date: 2018/8/16 11:31
 * @Description:
 */
public class CustomDate {
    /**
     * 参数时间做处理
     *
     * @param startTime
     * @param endTime
     * @return
     */
    public static Map<String, String> getStartAndEnd(String startTime, String endTime) {
        if (startTime == null || endTime == null) {
            Calendar now = Calendar.getInstance();
            startTime = String.valueOf(now.get(Calendar.YEAR)) + "-01-01 00:00:00";
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            endTime = df.format(new Date());
        }
        Map<String, String> map = new HashMap<>();
        map.put("startTime", startTime);
        map.put("endTime", endTime);
        return map;
    }
}
